package com.epoch.app.applicationperformancemonitor.model.enums;

import java.util.Arrays;
import java.util.Objects;

public enum DataCountEnum {
    FORECAST_ORDER("forecast_order_index", "ofs_forecast_order", "1", null, null);

    private String esTable;
    private String dbTable;
    private String id;
    private String esDataSource;
    private String dbDataSource;

    DataCountEnum(String esTable, String dbTable, String id, String esDataSource, String dbDataSource) {
        this.esTable = esTable;
        this.dbTable = dbTable;
        this.id = id;
        this.esDataSource = esDataSource;
        this.dbDataSource = dbDataSource;
    }

    public String getEsTable() {
        return esTable;
    }

    public void setEsTable(String esTable) {
        this.esTable = esTable;
    }

    public String getDbTable() {
        return dbTable;
    }

    public void setDbTable(String dbTable) {
        this.dbTable = dbTable;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getEsDataSource() {
        return esDataSource;
    }

    public void setEsDataSource(String esDataSource) {
        this.esDataSource = esDataSource;
    }

    public String getDbDataSource() {
        return dbDataSource;
    }

    public void setDbDataSource(String dbDataSource) {
        this.dbDataSource = dbDataSource;
    }

    public static DataCountEnum of(String id) {
        return Arrays.stream(DataCountEnum.values()).filter(source -> Objects.equals(id, source.getEsTable())).findFirst().orElse(null);
    }

}
